package com.z8888q.zstopwatch.sensorswork;

import com.z8888q.zstopwatch.ZstopwatchX;

public class DataWork {
	ZstopwatchX st;
	int screenHeight, screenWidth;
	int directionX = 1, directionY = 1;
	int deltaX = 0;
	int deltaY = 0;
	boolean isXChanged = false;
	float temp = 0;

	public DataWork(ZstopwatchX st) {
		this.st = st;
		screenHeight = st.screenHeight;
		screenWidth = st.screenWidth;
	}

	public void DoDataWork(float x, float y, float z) {

		if (Math.sqrt(x * x + y * y + z * z) < 8 || Math.sqrt(x * x + y * y + z * z) > 12) {
			temp = st.XChangeTemp;
			if (temp - x > 20) {
				if (st.button_cut.isEnabled())
					st.doCut();
				/**
				 * if(st.isBall){
				 * st.button_cut.setBackgroundResource(R.layout.buttonstyle31);
				 * st.isBall=false; }else{
				 * st.button_cut.setBackgroundResource(R.layout.buttonstyle3);
				 * st.isBall=true; }
				 */

				st.XChangeTemp = 0;
			}
			if (x > st.XChangeTemp)
				st.XChangeTemp = x;
		}
		// else st.button1.setBackgroundResource(R.drawable.icon);

		// st.text1.setText("x:"+x);
		// st.text2.setText("y:"+y);
		// st.text3.setText("Z:"+z);
		// st.handler.sendEmptyMessage(0);

	}

}
